Use go-jose for JWS parsing#463
Conversation
|
Thanks so much for brining this up! Thinking about this, if we're going to try to be resistant to pre-signature validation memory consumption, we probably want to reverse the order of operations and verify the JWT signature before checking claims. Currently we parse the JWT first to throw out bad values. As it stands, you can craft a payload that causes excessive memory allocation. Imagine some claims that look like the following. That'd have basically the same affect as the CVE you've linked to. Would you like to update this PR to do that? I'm happy to do that if not. |
|
That's a good idea; please take it up if you have the time. |
This change updates the verification logic of this library to first validate the ID Token instead of parsing claims. This hopefully makes it harder for a malicious client to provide an invalid token for validation that's crafted to cause this package to over-allocate memory. See the associated bug and CVE-2025-27144. Fixes coreos#463
This change updates the verification logic of this library to first validate the ID Token instead of parsing claims. This hopefully makes it harder for a malicious client to provide an invalid token for validation that's crafted to cause this package to over-allocate memory. See the associated bug and CVE-2025-27144. Fixes coreos#463
|
I went ahead and tagged https://github.com/coreos/go-oidc/releases/tag/v3.15.0 Thanks so much for reporting! |
This change updates the verification logic of this library to first validate the ID Token instead of parsing claims. This hopefully makes it harder for a malicious client to provide an invalid token for validation that's crafted to cause this package to over-allocate memory. See the associated bug and CVE-2025-27144. Fixes coreos#463
This change updates the verification logic of this library to first validate the ID Token instead of parsing claims. This hopefully makes it harder for a malicious client to provide an invalid token for validation that's crafted to cause this package to over-allocate memory. See the associated bug and CVE-2025-27144. Fixes coreos#463
go-oidc contains
parseJWT, which has the same vulnerability as go-jose: CVE-2025-27144. Instead of copying the updated code from go-jose, I opted to get rid ofparseJWTentirely and rely on go-jose for parsing. That led to a series of changes:unsigned token InsecureSkipSignatureCheckstarted failing because it was generating invalid JWSs that lacked the final.required for unsecured JWTs.unexpected signature algorithm "none"; expected ["RS256"]. I addressed that by explicitly enabling thenonealgorithm whenInsecureSkipSignatureCheckis set.This is technically a breaking change since
parseJWTrequired two or more.s in a JWS and would ignore the signature part, whereas go-jose is stricter about JWS correctness.